package router

import (
	"ChdChat-Gin/api"
	"ChdChat-Gin/middleware"
	"github.com/gin-gonic/gin"
)

func chatRoomGroup(subRouter *gin.RouterGroup) {
	chatRoomRouter := subRouter.Group("/v1.0")
	{
		chatRoomRouter.GET("/ws-connections", api.ConnectChatRoom)
		chatRoomRouter.DELETE("/actions", middleware.Authenticate(), api.QuitChatRoom)
		// chat history
		chatRoomRouter.GET("/chat-history", middleware.Authenticate(), api.FetchChatHistory)
		chatRoomRouter.DELETE("/chat-history", middleware.Authenticate(), api.DeleteChatHistory)

		chatRoomRouter.POST("/game-rooms", middleware.Authenticate(), api.CreateRoom)
		chatRoomRouter.PUT("/game-rooms", middleware.Authenticate(), api.JoinRoom)
		chatRoomRouter.POST("/games", middleware.Authenticate(), api.NewGame)
	}
}
